
import requestProxy from '@/utils/request';

const { request } = requestProxy;

// 操作日志
export function operatorLog(params) {
  return request({
    url: '/admin/auth/log',
    method: 'get',
    params
  });
}

// 操作员列表
export function operatorList(params) {
  return request({
    url: '/admin/auth/operator/list',
    method: 'get',
    params
  });
}

// 修改操作员状态
export function changeOperatorStatus(params) {
  return request({
    url: '/admin/auth/operator/status',
    method: 'put',
    data: params
  });
}
// 删除操作员
export function deleteOperator(params) {
  return request({
    url: '/admin/auth/operator/delete',
    method: 'delete',
    data: params
  });
}
// 创建操作员
export function createOperator(params) {
  return request({
    url: '/admin/auth/operator/add',
    method: 'post',
    data: params
  });
}
// 编辑操作员
export function editOperator(params) {
  return request({
    url: '/admin/auth/operator/edit',
    method: 'put',
    data: params
  });
}

// 角色列表
export function roleList(page, perPage, params = {}) {
  return request({
    url: '/admin/auth/role/list',
    method: 'get',
    params: {
      page,
      perPage,
      ...params
    }
  });
}

// 修改角色状态
export function changeRoleStatus(params) {
  return request({
    url: '/admin/auth/role/status',
    method: 'put',
    data: params
  });
}

// 删除角色
export function deleteRole(params) {
  return request({
    url: '/admin/auth/role/delete',
    method: 'delete',
    data: params
  });
}

// 创建角色
export function createRole(params) {
  return request({
    url: '/admin/auth/role/add',
    method: 'put',
    data: params
  });
}
// 编辑角色
export function editRole(params) {
  return request({
    url: '/admin/auth/role/edit',
    method: 'put',
    data: params
  });
}

// 获取权限id
export function getAuthId() {
  return request({
    url: '/admin/auth/list',
    method: 'get'
  });
}
export function editAuthRemark(data) {
  return request({
    url: '/admin/auth/remarks/edit',
    method: 'put',
    data
  });
}

// 按部门获取用户列表
export function getDepartmentUser(params) {
  return request({
    url: '/admin/user/department',
    method: 'get',
    params
  });
}

export function getRoleDetail(params) {
  return request({
    url: `/admin/auth/role/detail/${params.id}`,
    method: 'get',
    params
  });
}

// 角色管理-默认角色权限
export function getDefaultPermission() {
  return request({
    url: '/admin/auth/defaultPermission',
    method: 'get'
  });
}
export function getOperatorDetail(params) {
  return request({
    url: `/admin/auth/operator/detail/${params.id}`,
    method: 'get',
    params
  });
}

export function getPostList(params) {
  return request({
    url: '/admin/user/post/list',
    method: 'get',
    params
  });
}

export function mergeRoles(data) {
  return request({
    url: '/admin/auth/role/merge',
    method: 'post',
    data
  });
}
